//
//  MeViewController.m
//  WeiDuYY
//
//  Created by 王克杨的Mac on 2019/1/23.
//  Copyright © 2019 W ke杨. All rights reserved.
//

#import "MeViewController.h"
//自定义 cell
#import "YYTableViewCell.h"
#import "Xitongxiaoxi.h"
//几个界面头文件
#import "Touxiang.h"
#import "Wodexinxi.h"
#import "Wodeguanzhu.h"
#import "Goupiaojilu.h"
#import "Yijianfankui.h"
#import "Jianchagengxin.h"
#import "Tuichudenglu.h"

@interface MeViewController ()<UITableViewDelegate,UITableViewDataSource>
@property(nonatomic,strong)UITableView * tableView;
@property(nonatomic,strong)NSMutableArray * dataSource;


@end

static NSString *tbvYYcell = @"123";

@implementation MeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
   // self.automaticallyAdjustsScrollViewInsets = UIRectEdgeAll;
    
    [self prefersStatusBarHidden];
    [self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];

    //self.navigationItem.title = @"俄罗斯";
    //主界面颜色
    self.view.backgroundColor = [UIColor whiteColor];
    //初始化数据源
    self.dataSource = [[NSMutableArray alloc]init];
    //方法
    [self setNav];
    //添加
    [self.view addSubview:self.tableView];
    [self creater];

    
}
-(UITableView *)tableView{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:self.view.frame style:UITableViewStyleGrouped];
        //数据源和代理
        _tableView.delegate =self;
        _tableView.dataSource = self;
    }
    //表格注册
    [_tableView registerClass:[YYTableViewCell class] forCellReuseIdentifier:tbvYYcell];
    return _tableView;
}
- (BOOL)prefersStatusBarHidden
{
    return YES;//隐藏为YES，显示为NO
}


-(void)setNav{
    
    
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 1;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
 
    YYTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:tbvYYcell];
    
        cell.btnClickBlock = ^(int btnIndex) {

            switch (btnIndex) {
                case 1: {
                    //跳转到"我的信息"页面
                    NSLog(@"我的信息");
                    Wodexinxi * xinxi = [Wodexinxi new];
                    xinxi.hidesBottomBarWhenPushed = YES;
                    [self.navigationController pushViewController:xinxi animated:YES];
                }
                    break;

                case 2: {
                    //跳转到"我的关注"页面
                    NSLog(@"我的关注");
                    Wodeguanzhu * guanzhu = [Wodeguanzhu new];
                    guanzhu.hidesBottomBarWhenPushed = YES;
                    [self.navigationController pushViewController:guanzhu animated:YES];
                }
                    break;

                case 3:{
                    //跳转到"购票记录"页面
                    NSLog(@"购票记录");
                    Goupiaojilu * jilu = [Goupiaojilu new];
                    jilu.hidesBottomBarWhenPushed = YES;
                    [self.navigationController pushViewController:jilu animated:YES];
                }
                    break;

                case 4:{
                    //跳转到"意见反馈"页面
                    NSLog(@"意见反馈");
                    Yijianfankui * fankui = [Yijianfankui new];
                    fankui.hidesBottomBarWhenPushed = YES;
                    [self.navigationController pushViewController:fankui animated:YES];
                }
                    break;

                case 5:{
                    //跳转到"检查更新"页面
                    NSLog(@"检查更新");
                    Jianchagengxin * gengxin = [Jianchagengxin new];
                    gengxin.hidesBottomBarWhenPushed = YES;
                    [self.navigationController pushViewController:gengxin animated:YES];
                }
                    break;

                case 6:{
                    //跳转到"退出登录"页面
                    NSLog(@"退出登录");
                    Tuichudenglu * denglu = [Tuichudenglu new];
                    denglu.hidesBottomBarWhenPushed = YES;
                    [self.navigationController pushViewController:denglu animated:YES];
                }
                    break;

                default:
                    break;
            }
        };
    //cell 高度
    tableView.rowHeight = 300;

    cell.view1.backgroundColor = [UIColor whiteColor];
    cell.view2.backgroundColor = [UIColor whiteColor];
    cell.view3.backgroundColor = [UIColor whiteColor];
    //取消 cell 选中背景色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    [cell.btn1 addTarget:self action:@selector(buttonone) forControlEvents:UIControlEventTouchUpInside];
    
    return cell;
    
}

-(void)creater{
    //图片
    UIImageView *ima=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 250)];
    ima.image=[UIImage imageNamed:@"header"];
    //图片与用户的交互
    ima.userInteractionEnabled = YES;
    self.tableView.tableHeaderView=ima;
    //按钮
    UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(165, 40, 72, 72)];
    //切圆角
    btn.layer.cornerRadius = 35;
    btn.layer.masksToBounds = YES;
    [btn setBackgroundImage:[UIImage imageNamed:@"headerone"] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(buttonone) forControlEvents:UIControlEventTouchUpInside];
    //添加
    [ima addSubview:btn];
    //按钮
    UIButton * btn1 = [[UIButton alloc]initWithFrame:CGRectMake(24, 24, 30, 30)];
    [btn1 setBackgroundImage:[UIImage imageNamed:@"my_icon_remind_default_hdpi"] forState:UIControlStateNormal];
    [btn1 addTarget:self action:@selector(buttonone1) forControlEvents:UIControlEventTouchUpInside];
    
    //添加
    [ima addSubview:btn1];
}

-(void)buttonone{
    NSLog(@"头像界面");
    Touxiang * touxiang = [Touxiang new];
    touxiang.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:touxiang animated:YES];
    
}
-(void)buttonone1{
    NSLog(@"系统消息界面");
    Xitongxiaoxi * x = [Xitongxiaoxi new];
    x.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:x animated:YES];
}

//隐藏导航条方法
-(void)viewWillAppear:(BOOL)animated{
    self.navigationController.navigationBarHidden = YES;
}
-(void)viewDidDisappear:(BOOL)animated{
    self.navigationController.navigationBarHidden = YES;

}
@end
